#pragma once

#include "../umlmodel_global.h"

#include <memory>
#include <vector>

#include "NamedElement.h"

using std::make_shared;
using std::shared_ptr;
using std::vector;

namespace uml {
class Collaboration;
class Dependency;

/// <summary>
/// CollaborationUse
/// A CollaborationUse is used to specify the application of a pattern specified by
/// a Collaboration to a specific situation.
/// </summary>
class UMLMODEL_EXPORT CollaborationUse : public NamedElement {

public: // Constructors and destructors
    explicit CollaborationUse(const QString& umlType="uml::CollaborationUse");

public: // JsonSerializable override
    void fromJson(const QJsonObject& json, QStringList& errorList) override;
    void toJson(QJsonObject& json) override;

public: // Properties
    /// <summary>
    /// roleBindings getter
    /// A mapping between features of the Collaboration and features of the owning
    /// Classifier. This mapping indicates which ConnectableElement of the Classifier
    /// plays which role(s) in the Collaboration. A ConnectableElement may be bound to
    /// multiple roles in the same CollaborationUse (that is, it may play multiple
    /// roles).
    /// </summary>
    vector<shared_ptr<Dependency>>& roleBindings();

    /// <summary>
    /// type getter
    /// The Collaboration which is used in this CollaborationUse. The Collaboration
    /// defines the cooperation between its roles which are mapped to
    /// ConnectableElements relating to the Classifier owning the CollaborationUse.
    /// </summary>
    shared_ptr<Collaboration> type() const;

    /// <summary>
    /// type setter
    /// The Collaboration which is used in this CollaborationUse. The Collaboration
    /// defines the cooperation between its roles which are mapped to
    /// ConnectableElements relating to the Classifier owning the CollaborationUse.
    /// </summary>
    void setType(shared_ptr<Collaboration> value);

private: // Fields
    /// <summary>
    /// roleBindings
    /// A mapping between features of the Collaboration and features of the owning
    /// Classifier. This mapping indicates which ConnectableElement of the Classifier
    /// plays which role(s) in the Collaboration. A ConnectableElement may be bound to
    /// multiple roles in the same CollaborationUse (that is, it may play multiple
    /// roles).
    /// </summary>
    vector<shared_ptr<Dependency>> roleBindings_;

    /// <summary>
    /// type
    /// The Collaboration which is used in this CollaborationUse. The Collaboration
    /// defines the cooperation between its roles which are mapped to
    /// ConnectableElements relating to the Classifier owning the CollaborationUse.
    /// </summary>
    shared_ptr<Collaboration> type_;

};

} // namespace uml
